package com.zhiwei.codesecurity.web.api.jobtask;

import com.zhiwei.codesecurity.common.base.BaseJob;
import com.zhiwei.codesecurity.common.utils.SpringContextHolder;
import com.zhiwei.codesecurity.entity.ScheduleJob;
import com.zhiwei.codesecurity.service.checkmarx.ICheckMarxService;
import com.zhiwei.codesecurity.common.constants.ResourcesPropertiesConstants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class GetScanTaskReportJobTask extends BaseJob {
    private final static Logger logger = LoggerFactory.getLogger(GetScanTaskReportJobTask.class);

    @Override
    public void handeln(ScheduleJob scheduleJob) throws Exception {
        logger.info("======begin 获取生成扫描报告. scheduleJobId={}, jobName={}======", scheduleJob.getScheduleJobId(),
                scheduleJob.getJobName());
        ICheckMarxService checkMarxService = SpringContextHolder.getBean("checkMarxService");
        checkMarxService.getScanTaskReport(ResourcesPropertiesConstants.CHECKMARX_REPORT_DIR);
        logger.info("======end 获取生成扫描报告. scheduleJobId={}, jobName={}======", scheduleJob.getScheduleJobId(),
                scheduleJob.getJobName());
    }
}
